"""
    冒泡排序
"""

def bubble_sort(data):
    # 每次需要比较的次数
    for j in range(len(data)-1,0,-1):
        for i in range(j):
            if data[i] > data[i + 1]:
                # 两个位置数据互换，python 独有的语法
                data[i],data[i+1] = data[i+1],data[i]



list = [54,26,93,17,77,31,44,55,20]
bubble_sort(list)
print(list)